//
//  MZValidationType.swift
//  MZTool
//
//  Created by gby on 2023/2/10.
//

import Foundation


public enum MZValidationType{
    case none
    case successCodes
    case successAndRedirectcodes
    case customCode([Int])
    var statusCodes: [Int]{
        switch self {
        case .successCodes:
            return Array(200..<300)
        case .successAndRedirectcodes:
            return Array(200..<400)
        case .customCode(let codes):
            return codes
        case .none:
            return []
        }
    }
}


extension MZValidationType: Equatable{
    
    public static func == (lhs: MZValidationType, rhs: MZValidationType) -> Bool {
        switch (lhs, rhs) {
        case (.none, .none),
            (.successCodes, .successCodes),
            (.successAndRedirectcodes, .successAndRedirectcodes):
            return true
        case (.customCode(let code1), .customCode(let code2)):
            return code1 == code2
        default:
            return false
        }
    }
    
}
